<html>
<head><meta charset="utf-8"><title>ui test comments · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html">ui test comments</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189628149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189628149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189628149">(Mar 03 2020 at 19:57)</a>:</h4>
<p>Why do we have the comments in the <code>.rs</code> file (<code>//~ERROR ...</code>)? They are pretty annoying to change and they nullify the benefits of bless. They seem somewhat redundant to me. Am I missing something?</p>



<a name="189629269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189629269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189629269">(Mar 03 2020 at 20:08)</a>:</h4>
<p>they ensure that we actually get errors where errors should be</p>



<a name="189629343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189629343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189629343">(Mar 03 2020 at 20:08)</a>:</h4>
<p>when I write a compile-fail test that expects errors in 5 places, I want to be sure that someone dosnt use <code>--bless</code> on it until there is just 1 error left</p>



<a name="189629370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189629370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189629370">(Mar 03 2020 at 20:08)</a>:</h4>
<p>sometimes I also want to be sure that from multiple things that could error in that line, I get a specific error</p>



<a name="189631231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189631231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189631231">(Mar 03 2020 at 20:31)</a>:</h4>
<p>indeed, at some point we weren't requiring them for UI tests, and it was all too easy to overlook changes that were unexpected</p>



<a name="189654644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189654644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189654644">(Mar 04 2020 at 02:15)</a>:</h4>
<p><span class="user-mention" data-user-id="198054">@mark-i-m</span> they aren't as annoying as they used to be, since they no longer have to carry as much of the diagnostic message for their utility. Many people now just leave just the error code on them.</p>



<a name="189654649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189654649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189654649">(Mar 04 2020 at 02:15)</a>:</h4>
<p>(and leave the diagnostic details to the .stderr file)</p>



<a name="189655877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189655877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189655877">(Mar 04 2020 at 02:46)</a>:</h4>
<p>It's not a good idea to use error codes in <code>//~ ERROR</code> comments, as error codes are not really stable or meaningful</p>



<a name="189695742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189695742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189695742">(Mar 04 2020 at 14:29)</a>:</h4>
<p>To be honest, I prefer to include messages (as you imply is better practice), since they are indeed self-documenting and thus inherently more meaningful</p>



<a name="189695811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189695811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189695811">(Mar 04 2020 at 14:30)</a>:</h4>
<p>but I don't understand the basis with which you say that error codes are not stable.</p>



<a name="189744025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189744025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189744025">(Mar 04 2020 at 22:45)</a>:</h4>
<p>Error codes can be reused and whatnot; I don't think we have a rule that says "once you've used an error code for something you may never reuse it" -- but the main point is that they are not very meaningful when reading tests and whatnot</p>



<a name="189744094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189744094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189744094">(Mar 04 2020 at 22:46)</a>:</h4>
<p>if we had more semantic error codes instead of numbers I think the story might be different</p>



<a name="189751282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189751282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189751282">(Mar 05 2020 at 00:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> Hmm... so is it acceptable to truncate an existing test's comments? In particular, I have 97 failing tests on one of my branches because a word in an error changed (but it's still the same error).</p>



<a name="189751305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189751305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189751305">(Mar 05 2020 at 00:46)</a>:</h4>
<p>Oh, whoops Zulip was hiding the rest of this thread... reading it now</p>



<a name="189751398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189751398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189751398">(Mar 05 2020 at 00:49)</a>:</h4>
<p>Hmm... I see</p>



<a name="189751502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189751502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189751502">(Mar 05 2020 at 00:51)</a>:</h4>
<p>What if we made compiletest only check that the string in the error appears somewhere in the error message? Then, we could write much short comments that are less likely to go stale (and the full .stderr records the whole message).</p>



<a name="189751987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189751987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189751987">(Mar 05 2020 at 01:01)</a>:</h4>
<p><span class="user-mention" data-user-id="198054">@mark-i-m</span> I think it's acceptable to not include the whole string, assuming it includes some important parts</p>



<a name="189752078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752078">(Mar 05 2020 at 01:02)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> Do you mean that that's possible today or that you would be ok with us making it that way? (I'm aware that compiletest allows a prefix of an error, but does it allow arbitrary substrings?)</p>



<a name="189752082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752082">(Mar 05 2020 at 01:02)</a>:</h4>
<p>IIRC it's possible today (but not an arbitrary substring :)</p>



<a name="189752084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752084">(Mar 05 2020 at 01:02)</a>:</h4>
<p><span class="user-mention" data-user-id="198054">@mark-i-m</span> it's possible today to use a prefix</p>



<a name="189752111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752111">(Mar 05 2020 at 01:03)</a>:</h4>
<p>I  feel a prefix is the right balance</p>



<a name="189752202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752202">(Mar 05 2020 at 01:04)</a>:</h4>
<p>do you feel arbitrary substrings would be less likely to go stale than prefixes ?</p>



<a name="189752228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752228">(Mar 05 2020 at 01:05)</a>:</h4>
<p>(I assume it's not a question directed towards me)</p>



<a name="189752240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752240">(Mar 05 2020 at 01:06)</a>:</h4>
<blockquote>
<p>do you feel arbitrary substrings would be less likely to go stale than prefixes ?</p>
</blockquote>
<p>That's a great question</p>



<a name="189752286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752286">(Mar 05 2020 at 01:06)</a>:</h4>
<p>/me looks at my PR again</p>



<a name="189752379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752379">(Mar 05 2020 at 01:08)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> indeed :) I don't mind prefixes either, but if arbitrary substrings somehow managed to be better, maybe it could be worthwhile; I'm not sure diagnostics changes happen more likely in the beginning rather than the rest of the message</p>



<a name="189752396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752396">(Mar 05 2020 at 01:08)</a>:</h4>
<p>perhaps we should have a length restriction on the substring</p>



<a name="189752397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752397">(Mar 05 2020 at 01:09)</a>:</h4>
<p>e.g. the most recent PR where that happened to me was changes in the middle of the message</p>



<a name="189752404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189752404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189752404">(Mar 05 2020 at 01:09)</a>:</h4>
<p>"substring cannot be shorter than X characters"</p>



<a name="189753563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189753563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189753563">(Mar 05 2020 at 01:35)</a>:</h4>
<p>Another option of course is to not check the actual sting in the comment. That is, we only check that the right kind of diagnostic is emitted there, and the rest of the comment is purely documentation</p>



<a name="189753627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189753627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189753627">(Mar 05 2020 at 01:36)</a>:</h4>
<p>Looking at my PR again, I don't arbitrary substrings would really help, because in my case I was changing a key word in the error</p>



<a name="189772817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189772817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189772817">(Mar 05 2020 at 09:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="198054">mark-i-m</span> <a href="#narrow/stream/131828-t-compiler/topic/ui.20test.20comments/near/189753563" title="#narrow/stream/131828-t-compiler/topic/ui.20test.20comments/near/189753563">said</a>:</p>
<blockquote>
<p>Another option of course is to not check the actual sting in the comment. That is, we only check that the right kind of diagnostic is emitted there, and the rest of the comment is purely documentation</p>
</blockquote>
<p>that works already I think? You can just specify <code>//~ ERROR</code> without any info</p>



<a name="189776720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189776720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189776720">(Mar 05 2020 at 10:19)</a>:</h4>
<p>(Please don't do that though)</p>



<a name="189799825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189799825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189799825">(Mar 05 2020 at 15:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="126931">centril</span> <a href="#narrow/stream/131828-t-compiler/topic/ui.20test.20comments/near/189744025" title="#narrow/stream/131828-t-compiler/topic/ui.20test.20comments/near/189744025">said</a>:</p>
<blockquote>
<p>Error codes can be reused and whatnot; I don't think we have a rule that says "once you've used an error code for something you may never reuse it" -- but the main point is that they are not very meaningful when reading tests and whatnot</p>
</blockquote>
<p>I think there was explicit discussion in the past that we did not want to reuse error codes. The main reasoning was that error codes are a common thing that comes up when one uses a search engine to try to better understand an error message.</p>



<a name="189799894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189799894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189799894">(Mar 05 2020 at 15:02)</a>:</h4>
<p>my brief skims of my email chains and of internals.rlo posts did not bring up any evidence supporting my claim above, however.</p>



<a name="189799962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189799962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189799962">(Mar 05 2020 at 15:03)</a>:</h4>
<p>anyway that is why I said I was confused by <span class="user-mention" data-user-id="126931">@centril</span> 's statement that error codes were not stable. Because, to my mind, they are.</p>



<a name="189800301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800301">(Mar 05 2020 at 15:06)</a>:</h4>
<p>We don't generally re-use error codes and, even if we did, I don't think it's likely to cause any real problems.</p>



<a name="189800309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800309">(Mar 05 2020 at 15:06)</a>:</h4>
<p>Personally I thikn substring would likely be ok.</p>



<a name="189800336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800336">(Mar 05 2020 at 15:07)</a>:</h4>
<p>The ERROR lines are basically a heuristic to try and ensure that things don't change "too much" or in unexpected ways</p>



<a name="189800356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800356">(Mar 05 2020 at 15:07)</a>:</h4>
<p>I've sometimes wanted regex too :)</p>



<a name="189800379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800379">(Mar 05 2020 at 15:07)</a>:</h4>
<p>but anyway I <em>definitely</em> feel like that using some prefix is just fine, and I think I agree that <code>//~ ERROR</code> by itself is probably too little...</p>



<a name="189800393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800393">(Mar 05 2020 at 15:07)</a>:</h4>
<p>a "distinctive substring" seems fine though</p>



<a name="189800531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800531">(Mar 05 2020 at 15:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/131828-t-compiler/topic/ui.20test.20comments/near/189800301" title="#narrow/stream/131828-t-compiler/topic/ui.20test.20comments/near/189800301">said</a>:</p>
<blockquote>
<p>We don't generally re-use error codes and, even if we did, I don't think it's likely to cause any real problems.</p>
</blockquote>
<p>to elaborate: you'd have to (a) deprecate the ERROR code and (b) replace it with something semantically different and (c) have some test that unexpected creates this new error on the same line as before, all in one PR</p>



<a name="189800584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189800584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189800584">(Mar 05 2020 at 15:09)</a>:</h4>
<p>that said, I used to do the E123 codes, but I've started to avoid them because (as <span class="user-mention" data-user-id="116083">@pnkfelix</span> wrote) they're less self documenting</p>



<a name="189943577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189943577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189943577">(Mar 06 2020 at 23:06)</a>:</h4>
<p>I think compiletest actually already does only substring checking:</p>
<div class="codehilite"><pre><span></span>// src/tools/compiletest/src/runtest.rs:1375
                expected_errors.iter().enumerate().position(|(index, expected_error)| {
                    !found[index]
                        &amp;&amp; actual_error.line_num == expected_error.line_num
                        &amp;&amp; (expected_error.kind.is_none()
                            || actual_error.kind == expected_error.kind)
                        &amp;&amp; actual_error.msg.contains(&amp;expected_error.msg) // &lt;------ substring of error message
                });
</pre></div>



<a name="189943618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/189943618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#189943618">(Mar 06 2020 at 23:06)</a>:</h4>
<p>So if there is consensus, it seems that "distinctive substring" is the direction we want to go?</p>



<a name="190007222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/ui%20test%20comments/near/190007222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/ui.20test.20comments.html#190007222">(Mar 08 2020 at 09:29)</a>:</h4>
<p>I think that describes what I try to do, yes</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>